package com.asj.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.asj.R;

import java.util.List;

public class ProgressAdapter extends RecyclerView.Adapter<ProgressAdapter.ViewHolder> {

    private final List<String> progressSteps;

    public ProgressAdapter(List<String> progressSteps) {
        this.progressSteps = progressSteps;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_progress, parent, false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        holder.stepTextView.setText(progressSteps.get(position));
    }

    @Override
    public int getItemCount() {
        return progressSteps.size();
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        public final TextView stepTextView;

        public ViewHolder(View view) {
            super(view);
            stepTextView = view.findViewById(R.id.textView01);
        }
    }
}